﻿using System;
using System.Collections.Generic;

namespace Examples
{

	class Program
	{
		private static readonly IDictionary<int, Func<int, object>> Converters = new Dictionary<int, Func<int, object>>
																				{
																					{1, i => i.ConvertToString()},
																					{2, i => i.ConvertToDecimal()},
																					{3, i => i.ConvertToDouble()}
																				};

		static void Main(string[] args)
		{
			foreach (var converter in Converters)
			{
				var i = converter.Key;
				var function = converter.Value;
				var functionResult = function.Invoke(i);
				Console.WriteLine("Returned value is of type " + functionResult.GetType());
			}
		}
	}

	public static class IntExtentions
	{
		public static string ConvertToString(this int myInt)
		{
			return Convert.ToString(myInt);
		}

		public static decimal ConvertToDecimal(this int myInt)
		{
			return Convert.ToDecimal(myInt);
		}

		public static double ConvertToDouble(this int myInt)
		{
			return Convert.ToDouble(myInt);
		}
	}
}